﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine.Events;
using UnityEngine.UI;

// 游戏结束
public class GameOverDlg : Dialog
{
    Button _btnRestart;
    Button _btnExit;

    Text _textBest;
    Text _textCurrent;

    public GameOverDlg()
    {
        Init("UI/System/GameOver");
        _btnRestart = _root.FindComponent<Button>("BtnRestart");
        _btnExit = _root.FindComponent<Button>("BtnExit");

        _textBest = _root.FindComponent<Text>("Best/Value");
        _textCurrent = _root.FindComponent<Text>("Current/Value");
    }

    public void SetBtnCallback(UnityAction onRestart, UnityAction onExit)
    {
        _btnRestart.onClick.AddListener(onRestart);
        _btnExit.onClick.AddListener(onExit);
    }

    public void SetText(string best, string current)
    {
        _textBest.text = best;
        _textCurrent.text = current;
    }
}

